package com.hqyj.javaSpringBoot.modules.account.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hqyj.javaSpringBoot.modules.account.entity.Menu;
import com.hqyj.javaSpringBoot.modules.account.service.MenuService;
/**
 * @Description：MenuController
 * @Author ：Cwd
 * @Date ：2021/8/26 13:13
 */
@RestController
@RequestMapping("/api")
public class MenuController {

    @Autowired
    private MenuService menuService;

    /**
     * 127.0.0.1/api/menus ---- get
     */
    @GetMapping("/menus")
    public List<Menu> getAllMenus() {
        return menuService.getAllMenus();
    }

    /**
     * 127.0.0.1/api/menus/1 ---- get
     */
    @GetMapping("/menus/{userId}")
    public List<Menu> getMenusByUserId(@PathVariable int userId) {
        return menuService.getMenusByUserId(userId);
    }
}
